import logging.config
import os

from yuan_shen import file_util

file_util.create_not_exist('resources/log', isfile=False)  # 在当前工作目录创建log文件夹
current_dir = os.path.dirname(os.path.abspath(__file__))  # 获取当前文件的目录
config_file_path = os.path.join(current_dir, 'logger.ini')  # 构建 logger.ini 的完整路径
logging.config.fileConfig(config_file_path)


def get_logger(logger_name='miracle'):
    logger = logging.getLogger(logger_name)
    return logger
